package 第1节循环语句;

import java.util.Random;
import java.util.Scanner;

public class AnLi15 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        Random random = new Random();
        int number = random.nextInt(100);

        while (true) {
            System.out.print(">>>请输入数字:");
            int num = input.nextInt();
            if (num < number) {
                System.out.println(">>>小了");
            } else if(num > number){
                System.out.println(">>>大了");
            } else {
                System.out.println(">>>猜对了");
                break;
            }
        }
    }
}
